package chances.webui.model;

import java.util.Random;

import org.apache.commons.lang.StringUtils;

public class Tab {
	private String title;
	private boolean close;
	private String dataUrl;
	private String id;
	private String styleClass;
	private boolean selected;
	
	public String getTitle() {
		return title;
	}
	public boolean isClose() {
		return close;
	}
	public String getDataUrl() {
		return dataUrl;
	}
	public String getStyleClass() {
		return styleClass;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public void setClose(boolean close) {
		this.close = close;
	}
	public void setDataUrl(String dataUrl) {
		this.dataUrl = dataUrl;
	}
	public void setStyleClass(String styleClass) {
		this.styleClass = styleClass;
	}
	public String getId() {
		if (StringUtils.isBlank(id)) {
			Random rm = new Random();  
		    double pross = (1 + rm.nextDouble()) * Math.pow(10, 6);  
		    String fixLenthString = String.valueOf(pross);  
			id = "tab_"+fixLenthString.substring(1, 6 + 1);
			return id;
		}
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public boolean isSelected() {
		return selected;
	}
	public void setSelected(boolean selected) {
		this.selected = selected;
	}
	
}
